package com.zcf.service.impl;

import com.zcf.pojo.Log;
import com.zcf.common.result.PageResult;
import com.zcf.common.result.ResultVo;
import com.zcf.mapper.LogMapper;
import com.zcf.service.LogService;
import com.zcf.vo.in.PageVo;
import com.baomidou.mybatisplus.service.impl.ServiceImpl;
import com.github.pagehelper.PageHelper;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * <p>
 * 日志表 服务实现类
 * </p>
 *
 * @author loupeng
 * @since 2018-12-19
 */
@Service
public class LogServiceImpl extends ServiceImpl<LogMapper, Log> implements LogService {

	@Autowired
	private LogMapper logmapper;

	@Override
	public ResultVo addPunishment(PageVo pv, String userId) {
		if (pv.getPage() != null && pv.getPageSize() != null) {
			PageHelper.startPage(pv.getPage(), pv.getPageSize());
		}
		PageResult pr = PageResult.result(logmapper.addPunishment(userId));
		ResultVo rv = new ResultVo();
		rv.setList(pr.getRows());
		rv.setTotal(pr.getTotal());
		return rv;
	}
}
